package com.blueocean_health.care.management.service.impl;

import com.blueocean_health.care.management.domain.base.NurseCheckWork;
import com.blueocean_health.care.management.mapper.*;
import com.blueocean_health.care.management.service.CheckWorkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;
import java.util.stream.Collectors;

/**
 * @Author ChenPeng cp
 * @Date 2018/4/26 14:38
 */

@Service
public class CheckWorkServiceImpl implements CheckWorkService {

    @Autowired
    private NurseCheckWorkMapper nurseCheckWorkMapper;
   

    @Override
    public Map<String, Long> queryAllByStartAndEndTime(String startTime, String endTime) {
        List<NurseCheckWork> nurseCheckWorks = nurseCheckWorkMapper.queryAllByStartAndEndTime(startTime, endTime);
        Map<String, Long> collect = nurseCheckWorks.stream().collect(Collectors.groupingBy(NurseCheckWork::getWorkId, Collectors.counting()));
        return collect;
    }

   

    @Override
    public Integer queryByWorkIdAndGroupId(String workId, String groupId, String startTime, String endTime) {
        return nurseCheckWorkMapper.queryByWorkIdAndGroupId(workId, groupId, startTime, endTime);
    }


  
   
}
